//
//  H5WebViewController.swift
//  d11
//
//  Created by Jar Su on 1/30/20.
//  Copyright © 2020 Tech_001. All rights reserved.
//

import UIKit
import WebKit
class H5WebViewController: BXBaseVC ,WKNavigationDelegate{
//    var titleStr:String = ""
    var url:String = "https://www.baidu.com"
    override func viewDidLoad() {
        super.viewDidLoad()
        
//        let titleView = UIView()
//        let titleLabel = UILabel.init()
//        titleLabel.text = titleStr
//        titleLabel.font = UIFont.systemFont(ofSize: 18)
//        titleLabel.textColor = UIColor.white
//        titleView.addSubview(titleLabel)
//        titleLabel.snp.makeConstraints{(make) in
//            make.centerX.equalToSuperview()
//            make.centerY.equalToSuperview()
//            make.height.equalToSuperview()
//        }
//        navigationItem.titleView = titleView
        self.view.backgroundColor = HexRGBAlpha(0xEFF0F1, 1)
        //创建
        let wkWebView = WKWebView()
        wkWebView.navigationDelegate = self
        //添加
        self.view.addSubview(wkWebView)
         wkWebView.snp.makeConstraints { (make) in
           make.edges.equalTo(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
       }
          wkWebView.load( URLRequest(url: URL(string: url)!) )
        // 设置导航栏默认返回按钮
        self.leftButtonActionWithImg("icon_default_back")
    }
   
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        dismissLoadHUD()
    }
    func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
        showLoadHUD(title: "")
    }
}
